<?php

/**
 * Description of Date
 *
 * @author chiquitto
 */
class ZFKiller_Date
{

    /**
     *
     * @var ZFKiller_Date
     */
    private static $instance;

    /**
     * 
     * @return ZFKiller_Date
     */
    public static function getInstance()
    {
        if (null === self::$instance) {
            self::$instance = new self();
        }

        return self::$instance;
    }

    /**
     * 
     * @param int $inicio Timestamp
     * @param int $fim Timestamp
     * @return DateInterval
     */
    private function dateDiff($inicio, $fim)
    {
        $datetime1 = new DateTime();
        $datetime1->setTimestamp($inicio);
        
        $datetime2 = new DateTime();
        $datetime2->setTimestamp($fim);

        $interval = $datetime1->diff($datetime2);
        return $interval;
    }

    public function dateDiffDay($inicio, $fim)
    {
        return $this->dateDiff($inicio, $fim)->format('%a');
    }

}
